﻿using System;
using System.Windows;
using System.Collections.Generic;
using FireFly;
using System.Collections;

namespace XAMLStylePad.ViewModels.TriggersAndSetters
{
    public class EventSetterViewModel : XamlViewModelBase<EventSetter>, ISetterViewModel
    {
        public EventSetterViewModel(EventSetter setter)
            : base(setter)
        {

        }

        #region Event
        public RoutedEvent Event
        {
            get
            {
                return Model.Event;
            }
            set
            {
                Model.Event = value;
                OnPropertyChanged("Event");
            }
        }
        #endregion

        #region Handler
        public Delegate Handler
        {
            get
            {
                return Model.Handler;
            }
            set
            {
                Model.Handler = value;
                OnPropertyChanged("Handler");
            }
        }
        #endregion


        public override string DisplayName
        {
            get
            {
                return string.Format("{0} = {{1}}",
                    Event != null ? Event.Name : "<null>",
                    Handler != null ? Handler.ToString() : "<null>");
            }
        }

        public override ICollection VisualChildren
        {
            get
            {
                return null;
            }
        }
    }
}